function vtt(data,isWords){ //vtt于srt的文件格式差不多 ，为了方便，函数名字取一样的算了
                                           //将vtt 转换成一个数组

    let regex = /(\d{2}:\d{2}:\d{2}\,\d+)\s*-->\s*(\d{2}:\d{2}:\d{2}\,\d+)(?:[\r\n|\r]*)([\s\S]+?)(?:[\r\n|\r]*)([\s\S]+?)[\r\n|\r]{2}/g
    let regexOne  = /(\d{2}:\d{2}:\d{2}\,\d+)\s*-->\s*(\d{2}:\d{2}:\d{2}\,\d+)(?:[\r\n|\r]*)([\s\S]+)(?:[\r\n|\r]*)([\s\S]+)?[\r\n|\r]{2}/
    let matchResult = data.match(regex)
    //console.log(matchResult);
    let result = {}
    let tmp = []
    if(isWords){
        for(let i = 0; i< matchResult.length; i++ ){
            tmp = matchResult[i].match(regexOne)
            //if(i < 10) console.log(tmp)
            let time = countTime(tmp[1])
            let seconds = time[0]
            result[time[0]] = {
                cn:tmp[4],
                en:tmp[3]?tmp[3].split(/[\s,\.;]+/):'',
                exact:time[1]
            }
            // if(i == 20){
            //     console.log(result)
            // }
        }
    }else{
        for(let i = 0; i< matchResult.length; i++ ){
            tmp = matchResult[i].match(regexOne)
            let time = countTime(tmp[1])
            let end = countTime(tmp[2])

            result[time[0]] = {
                cn:tmp[4],
                en:tmp[3],
                exact: time[1],
                end
            }
            if(i == 20){
                //console.log(result,'sentence')
            }
        }
    }

    //同一秒出现的台词要合并

    return result
}


function countTime(timeStr){
    let regex = /(\d{2}):(\d{2}):(\d{2})\,(\d+)/
    let match = timeStr.match(regex)
    //秒 和 毫秒 毫秒用于更精确的判断
    return [parseInt(match[1])*3600 + parseInt(match[2])*60 + parseInt(match[3]), parseInt(match[4])*0.001];
}

function splitEnglish(sentence){
    let regex = /[a-zA-Z]+([\s,\.]+)/;
}


